<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xn="http://www.renren.com/2009/xnml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="{{ staticUrl }}/img/favicon.ico" rel="itgeeker favorite icon" type="image/x-icon" />
    <link href="{{ staticUrl }}/css/layout.css?ver={{ cssVersion }}" rel="stylesheet" type="text/css" media="all" />
    <link href="{{ staticUrl }}/css/profile.css?ver={{ cssVersion }}" rel="stylesheet" type="text/css" media="all" />
    <link href="{{ staticUrl }}/css/paper.css?ver={{ cssVersion }}" rel="stylesheet" type="text/css" media="all" />
    <link href="{{ staticUrl }}/css/adebook.css?ver={{ cssVersion }}" rel="stylesheet" type="text/css" media="all" />
    <title>ITGeeker—— {{ title }}</title>
    <script type="text/javascript" src="{{ staticUrl }}/js/base.js?ver={{ jsVersion }}"></script>
    <script type="text/javascript" src="{{ staticUrl }}/js/ajax.js?ver={{ jsVersion }}"></script>
    <script type="text/javascript" src="{{ staticUrl }}/js/paper.js?ver={{ jsVersion }}"></script>
    <script type="text/javascript">
        {% if containsMathml %}
            var paperIframeOK = false;
        {% endif %}
        function syncIframeHeight(height) {
            var iframe = $("paperIframe");
            if (iframe && height) {
                iframe.style.height = height.toString() + "px";
            }
            {% if containsMathml %}
                paperIframeOK = true;
            {% endif %}
        }
    </script>
    <script type="text/javascript" src="http://static.connect.renren.com/js/v1.0/FeatureLoader.jsp"></script>
</head>
<body>
    {% include "inc/top_bar.inc" %}
    {% if hasDeletePaperPermission %}
        <div style="display:none">
            <form method="post" action="/editpaper" id="delPaperForm">
                <input type="hidden" name="op" value="del"/>
                <input type="hidden" name="pid" value="{{ pid }}"/>
            </form>
        </div>
        <script type="text/javascript">
            function submitDelPaper() {
                if (confirm("你真的想删除这篇文章吗？删除后将无法恢复！")) {
                    var delForm = $("delPaperForm");
                    if (delForm) {delForm.submit();}
                }
            }
        </script>
    {% endif %}
    <div class="content_wrapper">
        <div id="content" class="content">
            <div class="profile_left">
                {% if errMsg %}
                    <p class="err_msg">{{ errMsg }}</p>
                {% else %}
                    <h2>{{ title }}</h2>
                    <div class="paper_header">
                        <a class="float_left" href="/profile?id={{ authorId }}"><img class="paper_photo" src="{{ authorPhoto }}" alt="{{ authorName }}"/></a>
                        <div class="paper_info">
                            <a href="/profile?id={{ authorId }}">{{ authorName }}</a>
                            <span class="paper_time">{{ lastModifiedTimeInLocalTimezone }}</span>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="{{ sysPaperUrlHowToRss }}">{{ navRssLink }}</a><a title="RSS源" href="/rss.xml?id={{ authorId }}"><img class="rss_sign" src="{{ staticUrl }}/img/rsssign.gif" /></a>
                            &nbsp;&nbsp;<a id="xnFeedLink" href="#" onclick="return false;">发送到人人网</a><img src="http://xnimg.connect.renren.com/img/connect/connect_logo/renren/logo.gif" alt="connect" class="connect_logo"/>
                            {% if hasEditPaperPermission %}
                                &nbsp;&nbsp;<a href="/editpaper?op=edit&pid={{ pid }}">编辑</a>
                            {% endif %}
                            {% if hasDeletePaperPermission %}
                                &nbsp;&nbsp;<a href="javascript:submitDelPaper();">删除</a>
                            {% endif %}
                        </div>
                        <div class="paper_info">
                           <span class="cat_title">文章类别：</span><a href="/?nav={{ catNav }}">{{catText}}</a>
                            {% if extraPaperInfo.containsMathml %}
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="paper_time" href="{{ sysPaperUrlFormulaNotDisplay }}">此文章包含公式，显示不正常？</a>
                            {% endif %}
                        </div>
                    </div>
                    <iframe id="paperIframe" src="/mathml/readpaper?pid={{ pid }}&mathml=1" frameborder="0" scrolling="no" style="width:600px;height:{{ initialIframeHeight }}px;overflow:visible"></iframe>
                    <div class="paper_tailer">
                        <a href="#commentEditorAnchor">发表评论</a>
                        {% if hasEditPaperPermission %}
                            &nbsp;&nbsp;<a href="/editpaper?op=edit&pid={{ pid }}">编辑</a>
                        {% endif %}
                    </div>
                    <div id="comments" class="comments">
                    {% for comment in commentList %}
                        <div id="c{{ comment.cid }}" class="comment_block">
                            <a class="float_left" href="/profile?id={{ comment.commenterId }}"><img class="comment_photo" src="{{ comment.commenterPhoto }}" alt="{{ comment.commenterName }}"/></a>
                            <div class="comment_info">
                                {% if comment.hasDeleteCommentPermission %}<span class="float_right"><a class="x_mark" href="javascript:delComment({{ comment.cid }});">x</a></span>{% endif %}
                                <a href="/profile?id={{ comment.commenterId }}">{{ comment.commenterName }}</a>
                                <span class="paper_time">{{ comment.createdTimeInLocalTimezone }}</span>
                            </div>
                            <div class="comment_reply">
                               {{ comment.comment }} {% ifnotequal xnuid comment.commenterId %}<a href="javascript:replyToCommenter({{ xnuid }}, {{ comment.commenterId }}, '{{ comment.commenterName }}');">回复</a>{% endifnotequal %}
                            </div>
                        </div>
                    {% endfor %}
                        <div class="comment_block" id="ceditor_blk">
                            <a class="float_left" name="commentEditorAnchor" href="/profile?id={{ xnuid }}"><img class="comment_photo" src="{{ userPhoto }}" alt="{{ userName }}"/></a>
                            <div class="comment_info">
                                <textarea id="pcomment" name="pcomment"></textarea>
                            </div>
                            <div class="comment_editor">
                                <input type="button" id="submitComment" class="input-button" value="发表评论" onclick="submitComment({{ pid }}, {{ authorId }}, '{{ userName }}', '{{ title }}', '{{ siteUrl }}/mathml/readpaper?pid={{ pid }}', '{{ siteName }}', '{{ siteUrl }}');"/>
                                <span class="notify_switch">
                                    <input id="notification" name="notification" type="checkbox" checked="checked" class="notification"/>
                                    <label for="notification">在人人网上通知对方</label>
                                </span>
                            </div>
                        </div>
                    </div>
                {% endif %}
            </div>
            <div class="adebook_right">
                {% if adebookList %}
                    <div class="adebook_header">
                        推荐书籍
                    </div>
                {% endif %}
                {% for adebook in adebookList %}
                    <div class="adebook_blk">
                        <div>
                            <a target="_blank" href="{{ adebook.link }}"><img class="adebook_img" src="{{ adebook.imgsrc }}" /></a>
                        </div>
                        <div class="adebook_descr">
                            “{{ adebook.descr }}”
                        </div>
                    </div>
                {% endfor %}
            </div>
            <div style="clear:both"></div>
        </div>
    </div>
    {% include "inc/footer.inc" %}
    <script type="text/javascript">
        {% if containsMathml %}
            function paperIframeCheck() {
                if (!paperIframeOK) {
                    if (confirm("本文章含有数学公式，但系统检测到你的浏览器可能无法正常显示。你想通过安装插件来解决这个问题吗？")) {
                        window.location = "{{ sysPaperUrlFormulaNotDisplay }}";
                    }
                }
            }
            if (window.navigator.userAgent.toLowerCase().indexOf("msie") != -1) {
                setTimeout(paperIframeCheck, 4000);
            }
        {% endif %}
    </script>
    <script type="text/javascript">
        XN_RequireFeatures(["Api", "Connect.Feed"], function(){
            XN.Main.init("{{ api_key }}", "/channel/xd_receiver.html");
            ZTL.addEventListener($("xnFeedLink"), "click", function(){
                XN.Connect.requireSession(function(){
                    var imgSrc = undefined;
                    {% if extraPaperInfo.firstImageSrc %}
                        imgSrc = "{{ extraPaperInfo.firstImageSrc }}";
                        if (imgSrc.indexOf("/") == 0)
                            imgSrc = "{{ siteUrl }}" + imgSrc
                    {% else %}
                        {% if extraPaperInfo.containsMathml %}imgSrc = "{{ defaultMathmlLogo }}";{% endif %}
                    {% endif %}
                    sendXnFeed("{{ siteUrl }}", "{{ siteName }}", "{{ title }}", "{{ siteUrl }}/mathml/readpaper?pid={{ pid }}", "{{ content }}", imgSrc);
                });
            })
            pcommentStatus.connectJsLoaded = true;
        });
    </script>
</body>
</html>
